package cn.dhnep.demo.controller;


import cn.dhnep.demo.pojo.HelpCenter;
import cn.dhnep.demo.pojo.Notice;
import cn.dhnep.demo.service.HelpCenterService;
import cn.dhnep.demo.util.Page;
import cn.dhnep.demo.util.ResultMap;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  帮助中心
 * </p>
 *
 * @author dhn
 * @since 2021-09-08
 */
@RestController
@RequestMapping("/helpcenter")
public class HelpCenterController {

    @Resource
    private HelpCenterService helpCenterService;

    private Map<String,Object> result = new HashMap<>();


    @ApiOperation("提问中心分页查询")
    @RequestMapping("listPage")
    public ResultMap<List<HelpCenter>> HelpCenterList(Page page, @RequestParam("limit") Integer limit) throws UnsupportedEncodingException {
        page.setRows(limit);
        List<HelpCenter>helpCenterList=helpCenterService.selectPageList(page);
        int totals=helpCenterService.selectPageCount(page);
        page.setTotalRecord(totals);
        return new ResultMap<List<HelpCenter>>("",helpCenterList,0,totals);
    }
}

